package com.ats.serviceimpl;

import com.ats.dao.JobRecordDao_xh;
import com.ats.daoimpl.JobRecordDaoImpl_xh;
import com.ats.service.JobRecordSerivce_xh;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
 * 作业记录功能的Service层实现类
 * @author xh
 *
 */
public class JobRecordSerivceImpl_xh implements JobRecordSerivce_xh{
	JobRecordDao_xh jrdao = new JobRecordDaoImpl_xh();
	@Override
	public JSONObject findJobRecordBySid(int sid,int start,int rows) {
		// TODO Auto-generated method stub
		JSONObject  jObj = new JSONObject();
		jObj.put("total",jrdao.findAllJobRecordBySid(sid));
		jObj.put("rows", jrdao.findJobRecordBySid(sid, start, rows));
		return jObj;
	}
	@Override
	public boolean updateJobRecordBySid(String endTime,int sid,int jrid,String answer) {
		// TODO Auto-generated method stub		
		return jrdao.updateJobRecordBySid(endTime, sid, jrid,answer);
	}
	@Override
	public JSONObject findJobRecordByTid(int tid, int start, int rows) {
		// TODO Auto-generated method stub
		JSONObject  jObj = new JSONObject();
		jObj.put("total",jrdao.findAllJobRecordByTid(tid));
		jObj.put("rows", jrdao.findJobRecordByTid(tid, start,rows));
		return jObj;
	}
	@Override
	public boolean updateJobRecordByTidAndJrid(int grade,int jrid,int tid) {
		// TODO Auto-generated method stub
		return jrdao.updateJobRecordByTidAndJrid(grade, jrid, tid);
	}
	@Override
	public JSONObject findAllJobRecordBySid(int sid, int start, int rows) {
		// TODO Auto-generated method stub
		JSONObject  jObj = new JSONObject();
		jObj.put("total",jrdao.findAllRecordBySid(sid));
		jObj.put("rows", jrdao.findAllJobRecordBySid(sid, start, rows));
		return jObj;
	}
	@Override
	public JSONObject findAllJobRecordByTid(int tid, int start, int rows) {
		// TODO Auto-generated method stub
		JSONObject  jObj = new JSONObject();
		jObj.put("total",jrdao.findAllRecordByTid(tid));
		jObj.put("rows", jrdao.findAllJobRecordByTid(tid, start, rows));
		return jObj;
	}
	@Override
	public JSONArray findAllJobRecordBySidAndJsid(int sid, int jsid) {
		// TODO Auto-generated method stub
		return jrdao.findAllJobRecordBySidAndJsid(sid, jsid);
	}
	@Override
	public JSONArray findAllJobRecordByTidAndJsid(int tid, int jsid) {
		// TODO Auto-generated method stub
		return jrdao.findAllJobRecordByTidAndJsid(tid, jsid);
	}



}
